import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Example extends Thread {
	volatile boolean stop = false;
	volatile ServerSocket socket;  

	public void run() {
		System.out.println(111);
		while (!stop) {
			System.out.println("Thread is running...");
			try {
				Socket sock = socket.accept();
			} catch (IOException e) {
				System.out.println("accept() failed or interrupted...");
			}
		}
		System.out.println("Thread exiting under request...");
	}
}